/***
 * @Author: 玄绮 shijiahansi@qq.com
 * @Date: 2024-06-09 14:12:20
 * @LastEditors: 玄绮 shijiahansi@qq.com
 * @LastEditTime: 2024-06-09 14:17:52
 * @FilePath: \server\src\server\app\ChatHttpServer.h
 * @Description:
 * @
 * @Copyright (c) 2024 by 玄绮, All Rights Reserved.
 */

#include <HttpServer.hpp>
#include <boost/shared_ptr.hpp>

class ChatHttpServer
    : public rdhttp::HttpServer {
public:
    using SharedPtr            = boost::shared_ptr<ChatHttpServer>;
    const std::string domain = "http://127.0.0.1";

public:
    ChatHttpServer(boost::asio::io_context& ctx, std::int32_t port = 8888, std::string doc_root = "./");
    ~ChatHttpServer() = default;

protected:
    void init();

    template <typename Handler>
    rdhttp::PosttHandler post_handler(Handler handler) {
        return std::bind(handler, this, std::placeholders::_1, std::placeholders::_2);
    }

protected:
    void uploadfile(rdhttp::HttpRequest& request, rdhttp::HttpResponse& response);
};
